package pam.security;

import java.util.Iterator;
import java.util.List;

public abstract class AbstractPermissionFactory implements IPermissionFactory {

	public Permission getPermission(long id) {

		List list = getPermissions();
		if (list == null) {
			return null;
		}

		Iterator iterator = list.iterator();
		while (iterator.hasNext()) {
			Permission tmp = (Permission) iterator.next();
			if (tmp == null) {
				continue;
			}

			if (tmp.getId() == id) {
				return tmp;
			}
		}

		return null;
	}

}
